import request from '@/config/axios'

export interface StudentVO {
  id: number
  studentName: string
  studentCode: string
  schoolId: number
  collegeId: number
  classesId: number
  sex: number
}

// 查询学生分页
export const getStudentPage = async (params) => {
  return await request.get({ url: `/cmis/student/page`, params })
}

// 查询学生分页
export const queryStudentPage = async (data) => {
  return await request.post({ url: `/cmis/student/queryPage`, data })
}

// 查询学生列表
export const getStudentList = async (params) => {
  return await request.get({ url: `/cmis/student/list`, params })
}

// 查询学生列表
export const queryStudentList = async (data) => {
  return await request.post({ url: `/cmis/student/query`, data })
}

// 查询学生详情
export const getStudent = async (id: number) => {
  return await request.get({ url: `/cmis/student/get?id=` + id })
}

// 新增学生
export const createStudent = async (data: StudentVO) => {
  return await request.post({ url: `/cmis/student/create`, data })
}

// 修改学生
export const updateStudent = async (data: StudentVO) => {
  return await request.put({ url: `/cmis/student/update`, data })
}

// 删除学生
export const deleteStudent = async (id: number) => {
  return await request.delete({ url: `/cmis/student/delete?id=` + id })
}

// 导出学生 Excel
export const exportStudent = async (params) => {
  return await request.download({ url: `/cmis/student/export-excel`, params })
}

// 导入批量导入学生
export const importStudent = async (data) => {
  return await request.post({ url: `/cmis/student/import`, data })
}

// 批量删除学生
export const batchDeleteStudent = async (ids: Array<string>) => {
  return await request.delete({ url: `/cmis/student/batchDelete?ids=` + ids })
}
// 条件删除学生
export const conditionDeleteStudent = async (data) => {
  return await request.post({ url: '/cmis/student/condition-delete', data })
}
// 班级学生升学
export const ContinueStudy = async (data: StudentVO) => {
  return await request.post({ url: `cmis/student/continue-study`, data })
}
// 班级学生升学
export const ContinueStudyListPage = async (params) => {
  return await request.get({
    url: `cmis/student/can-transfer-out-student-page`,
    params
  })
}
// 批量导入学生照片（压缩包）
export const importStudentImages = async (data) => {
  console.log(data, '啥啥啥啥这个')

  return await request.post({
    url: `/cmis/student/import-photo`,
    data,
    headersType: { 'Content-Type': 'multipart/form-data' }
  })
}
